local _MainItem = require "UI/Main/main_item"

local MainView = MainView or BaseClass(BaseView)

function MainView:__init()
	self.base_file = "Main"
	self.layout_file = "MainView"
	self.layer_name = "Main"
	self.load_callback = function()
		self:LoadSuccess()
		self:InitEvent()
		self:SetData()
	end
end

function MainView:Open()
	BaseView.Open(self)
end

function MainView:LoadSuccess()
	self.layout = self.transform:Find("layout")
end

function MainView:InitEvent()
	-- body
end

function MainView:SetData()
	if self.bag_item == nil then
		self.bag_item = _MainItem.New(self.layout)
	end
end

function MainView:__delete()
	if self.bag_item then
		self.bag_item:DeleteMe()
		self.bag_item = nil
	end
end

return MainView